import * as TYPES from '../../actions/actionTypes'
const initialState = {
    loading: true,
    InventoryId: 0,
    inv_code: 0,
    inv_time: '',
    item: '',
    itemTitle: '',
    dataList: null,
}

export default function Result(state = initialState, action) {
    switch (action.type) {
        case TYPES.INVERTORY_DETAIL_RESULT_INITIAL:
            return {
                ...state,
                loading: action.data.loading,
                InventoryId: action.data.InventoryId,
                inv_code: action.data.inv_code,
                inv_time: action.data.inv_time,
                item: action.data.item,
                itemTitle: action.data.itemTitle,
            };
        case TYPES.INVERTORY_DETAIL_RESULT_GETGOODS_ING:
            return {
                ...state,
                loading: true
            };
        case TYPES.INVERTORY_DETAIL_RESULT_GETGOODS_FAIL:
            return {
                ...state,
                loading: false,
                dataList:null
            };
        case TYPES.INVERTORY_DETAIL_RESULT_GETGOODS_SUCCESS:
            return {
                ...state,
                loading: false,
                dataList: action.dataList
            };
        default:
            return state
    }
}